home *** CD-ROM | disk | FTP | other *** search
/ The Original Shareware 1.1 / The Original Shareware (WeMake CDs)(Volume 1.1)(CDs, Inc)(1993).iso / 6 / hsatxt.zip / TX_DEMO.C < prev    next >
Text File  |  1988-02-14  |  4KB  |  148 lines

  1. /************************************************************************/
  2. /*                                                                        */
  3. /*            T X _ D E M O . C   -   Demo of HSA_TEXT Library            */
  4. /*                                                                        */
  5. /************************************************************************/
  6.  
  7. /************************************************************************/
  8. /*                                                                        */
  9. /*        Copyright (c) Hardwood Software Associates 1986                    */
  10. /*                                                                        */
  11. /*                    Hardwood Software Associates                        */
  12. /*                    364 Benson Road                                        */
  13. /*                    Northbridge, Ma 01534                                */
  14. /*                                                                        */
  15. /************************************************************************/
  16.  
  17. /*************************************************************************
  18.  *                T X _ D E M O   E D I T   L O G 
  19.  *    $Log:   D:/CRT/VCS/TX_DEMO.C_V  $
  20.  *    
  21.  *       Rev 1.1   14 Feb 1988  9:30:06   R. Evans
  22.  *    Add new compiler support and mouse
  23.  *    
  24.  *       Rev 1.0   07 Nov 1987 16:10:18   R. Evans
  25.  *    Initial revision.
  26.  ************************************************************************/
  27.  
  28. /************************************************************************
  29.  *                                                    +-------------------+
  30.  *        Author: R. Evans                            | F U N C T I O N S |
  31.  *        Date:    October, 1986                        +-------------------+
  32.  *
  33.  ************** TX_DEMO - HSA_TEXT Demo
  34.  * SYNOPSIS:
  35.  *                tx_demo [B|D]
  36.  *                    B - Use BIOS routine
  37.  *                    D - Use direct access
  38.  * DESCRIPTION:
  39.  *                Demo the important aspects of the HAS_TEXT library.
  40.  *
  41.  *************************************************************************/
  42. #include "stdio.h"
  43. #include "hsa_tx.h"
  44.  
  45. #define FALSE    0
  46. #define TRUE    1
  47.  
  48. int direct = TRUE;
  49. int mono;
  50. int save [SCREEN_WIDTH*SCREEN_LENGTH];
  51.  
  52. main (argc,argv)
  53. int argc;
  54. char *argv[];
  55. {
  56. mono = (tx_state () == MONOCHROME);                /* Set crt type */
  57.  
  58. if (*argv[1] == 'B' || *argv[1] == 'b')
  59.     direct = FALSE;
  60. else 
  61.     tx_direct ();
  62. introduction ();
  63. pause ("About to save entire screen.");
  64. tx_rd_blk (0,0,save,SCREEN_LENGTH,SCREEN_WIDTH);
  65. pause ("Screen saved.");
  66. description ();
  67. pause ("About to restore previously save screen.");
  68. tx_wr_blk (0,0,save,SCREEN_LENGTH,SCREEN_WIDTH);
  69. pause ("");
  70. tx_bios (); tx_loc (22,0); tx_cur_show ();
  71. }
  72.  
  73. heading ()
  74. {
  75. tx_clr ();
  76. tx_str_a (0,18,"HSA_TEXT",SCR_BOLD);
  77. tx_str_c (" - Text Mode Screen Control \"");
  78. if (direct)
  79.     tx_str_a_c ("DIRECT",(mono)?SCR_UNDER:SCR_GREEN);
  80. else 
  81.     tx_str_a_c ("BIOS",(mono)?SCR_UNDER:SCR_RED);
  82. tx_str_c ("\"");
  83. } /* Of heading */
  84.  
  85. introduction ()
  86. {
  87. heading ();
  88. box (10);
  89. tx_str (4,5,"HSA_TEXT is a library of C  functions that provide direct, fast control");
  90. tx_str (5,5,"over the IBM PC screen in text mode.  Also  included  are  functions to");
  91. tx_str (6,5,"allow  mouse interfacing.  The functions have been developed and tested");
  92. tx_str (7,5,"for  the  Microsoft version 5.00 and Turbo  C version 1.5  by  Hardwood");
  93. tx_str (8,5,"Software  Associates.");
  94. tx_str (10,25,"We hope you find them useful.");
  95. pause ("");
  96. } /* Of introduction */
  97.  
  98. description ()
  99. {
  100. heading ();
  101. box (14);
  102. tx_attr_set (MAKE_ATTR(SCR_WHITE|SCR_INTENSE_BIT,SCR_BLUE));
  103.  
  104. tx_str (5,2,"This  program  is  a  brief demonstration of some of the capabilities of the");
  105. tx_str (6,2,"HSA_TEXT library.  It  accepts a  single  parameter  on  the  command  line:");
  106. tx_str (7,2,"B - BIOS  mode;  D - DIRECT mode. BIOS  mode  is  the most portable.  DIRECT");
  107. tx_str (8,2,"mode is much faster.                                                        ");
  108.  
  109. tx_str (10,2,"HSA_TEXT is a complete  set  of  functions  for  displaying and manipulating");
  110. tx_str (11,2,"the text mode screen on an IBM PC.  In addition to functions to display text");
  111. tx_str (12,2,"HSA_TEXT contains functions to rapidly read and write blocks of screen data.");
  112. tx_str (13,2,"Functions that read text only from the screen are also included.            ");
  113. tx_norm ();
  114. pause ("");
  115. }
  116. box (size)
  117. int size;
  118. {
  119. int i;
  120. tx_attr_set (MAKE_ATTR(SCR_WHITE|SCR_INTENSE_BIT,SCR_BLUE));
  121. tx_chr (2,0,'╔');
  122. tx_fill_c ('═',78);
  123. tx_chr_c ('╗');
  124. for (i=3;i<size+2;i++)
  125.     {
  126.     tx_chr (i,0,'║');
  127.     tx_chr (i,79,'║');
  128.     }
  129. tx_chr (size+2,0,'╚');
  130. tx_fill_c ('═',78);
  131. tx_chr_c ('╝');
  132. tx_norm ();
  133. }
  134. pause (msg)
  135. char *msg;
  136. {
  137. CRT_STATUS crt;
  138. tx_get_status (&crt);
  139. tx_cur_hide ();
  140. tx_str (24,0,msg);
  141. tx_str_c (" Press any key to continue.");
  142. getch ();
  143. tx_loc (24,0);
  144. tx_clr_eol ();
  145. tx_put_status (&crt);
  146. } /* Of pause */
  147.  
  148.